<template>
  <div class="home-header">
    <div class="header-left">
      <div class="iconfont icon-back">&#xe658;</div>
    </div>
    <div class="header-input">
      <span class="iconfont">&#xe63c;</span>输入城市/景点/游玩主题
    </div>
    <router-link to='/city'>
      <div class="header-right">{{this.city}}<span class="iconfont icon-down">&#xe65c;</span></div>
    </router-link>
  </div>
</template>

<script>
  import { mapState } from 'vuex'
  export default {
    name: 'Header',
    computed: {
      ...mapState(['city'])
    }
  }
</script>
<!-- 通用 lang="stylus" 声明后，就可以使用stylus书写CSS样式；
     scoped 声明了此组件内的CSS样式就只能作用于当前的组件-->
<style lang="stylus" scoped>
  @import '~@S/varibles.styl'
  .home-header
    display: flex
    line-height: $headerHeight
    height: $headerHeight
    background: $bgColor
    color: #fff
    position: fixed
    top: 0
    left: 0
    right: 0
    z-index: 99
    .header-left
      width: .64rem
      float: left
      .icon-back
        font-size: .5rem
        text-align: center
    .header-input
      flex: 1
      background: #fff
      border-radius: .1rem
      line-height: .62rem
      height: .62rem
      margin-top: .12rem
      // margin-left: .2rem
      padding-left: .1rem
      color: #ccc
    .header-right
      float: right
      min-width: 1.04rem
      padding: 0 .1rem
      font-size: .28rem
      text-align: center
      color: #fff
      .icon-down
        font-size: .36rem
</style>
